package com.etennis.utils;

import com.etennis.security.LoginUserDetails;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecurityUtils {
    public static LoginUserDetails getLoginUser()
    {
        return (LoginUserDetails) getAuthentication().getPrincipal();
    }
    public static Authentication getAuthentication() {
        return SecurityContextHolder.getContext().getAuthentication();
    }

    public static Long getLoginUserId(){
        return getLoginUser().getUser().getId();
    }

    public static Long getLoginUserClubId(){
        return 1L;
    }
}